#set(SysRole role)
<form action="save" method="post" id="addform">
	<input id="id" name="id" type="hidden" value="${role.get('id')}"/>
	<input id="rights" name="rights" type="hidden" value="${role.get('rights')}"/>
    <p><label>角色名称：</label><input id="name" name="name" type="text" value="${role.get('name')}" required/></p>
	<p><label>角色备注：</label><textarea rows="3" cols="" id="remark" style="vertical-align: middle;" name="remark">${role.get('remark')}</textarea></p>
	<p><label>角色权限：</label><ul id="ztree" class="ztree"></ul></p>
</form>
<style>
<!--
#addform p { padding:5px;  }
#addform input,#addform textarea { width:13em; padding:4px; border:1px solid #CCC;}
#addform .radio { width:2em; padding:4px; border:1px solid #CCC; }
#addform input:focus { border-color:#426DC9; }
#addform .login-form-error { background:#FFFBFC; border-color:#F00 !important; }
.input {
	border: 1px solid #999;
	background-color: #fff;
	box-shadow: inset 0 1px rgba(0,0,0,.15);
	padding: 5px;
}
.input[disabled] {
	background-color: #eee;
	box-shadow: none;
}
-->
</style>
<script type="text/javascript">
$("#addform").html5Validate(function(){
	$.ajax({
		url:'save',
		type:'post',
		dataType:'json',
		data:$("#addform").serialize(),
		success:function(d){
			if(d.success){
				$.dialog({title:'提示',content:'操作成功'}).time(3);	
				api.close();
			}else{
				$.dialog({title:'提示',content:d.msg}).time(3);
				api.close();
			}
			reloadMe();
		},
		error:function(){
			$.dialog({title:'提示',content:'操作失败,服务器错误.'}).time(3);	
			api.close();
		}
	});
},{validate:function(){
	var zTree = $.fn.zTree.getZTreeObj("ztree"),
	nodes = zTree.getCheckedNodes();
	var ids = new Array();
	for (var i=0, l=nodes.length; i<l; i++) {
		ids.push(nodes[i].id);
	}
	$("#rights").val(ids.join(","));
	return true;
}});
var setting = {
    check: {
		enable: true
	},
	data: {
		simpleData: {
			enable: true
		}
	}
};
$.fn.zTree.init($("#ztree"), setting, $!{menuNodes});
</script>